{template 'common/header'}
<div class="clearfix">
<ul class="nav nav-tabs">
	<li class="active"><a href="{php echo $this->createWebUrl('huodong')}">活动</a></li>
	<li><a href="{php echo $this->createWebUrl('huodong_post')}">添加活动</a></li>
</ul>
<div class="panel panel-default">
	<div class="panel-heading">(<span style="color:red">点击“一键添加系统预设活动”会把抽奖功能，挑战赛功能，步数商城功能同步过来。尽量此按钮点击一次。多次点击添加，可以删除重复的。</span>)</div>
	<div class="panel-body">
		<form action="" method="post" class="form-horizontal" role="form" id="form">
			<div class="form-group">
				<!-- <label class="col-md-2 control-label">店名</label>
				<div class="col-md-5">
					<input type="text" class="form-control" name="keyword" id="keyword" value="{$keyword}">
				</div> -->
				<div class="text-center col-md-2" style="position:absolute;left:47%;">
					<!-- <button type="submit" class="btn btn-primary"><i class="fa fa-rocket"></i>一键添加系统预设活动</button> -->
					<a href="{php echo $this->createWebUrl('huodong_post',array('act'=>'auto'))}" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="top" title="" data-original-title="一键添加系统预设活动"><i class="fa fa-rocket">一键添加系统预设活动</i></a>
					<a href="{php echo $this->createWebUrl('huodong_post',array('act'=>'delete'))}" onclick="return confirm('确认清空吗');return false;" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="top" title="" data-original-title="清空活动"><i class="fa fa-rocket">清空活动</i></a>
					<!-- <span class="help-block">点击“一键添加系统预设活动”会把抽奖功能，挑战赛功能，步数商城功能同步过来。尽量此按钮点击一次。多次点击添加，可以删除重复的。</span> -->
				</div>

			</div>
		</form>
	</div>
</div>
<div class="main panel panel-default">
	<div class="table-responsive">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:10%;" class="text-center">id</th>
					<th style="width:30%;" class="text-center">封面图</th>
					<th style="width:10%;" class="text-center">排序</th>
					<th style="width:10%;" class="text-center">是否显示</th>
					<th style="width:20%;" class="text-center">活动类型</th>
					<th class="text-center" style="width:30%;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $index $item}
					<tr>
						<td class="text-center">{$item['id']}</td>
						<td class="text-center"><img class="scrollLoading" src="{media $item['entrypic']}" data-url="{media $item['entrypic']}" onerror="this.src='/web/resource/images/nopic-small.jpg'" height="70" width="70"></td>
						<td class="text-center"><input type="text" class="form-control displayorder" data-id="{$item['id']}" name="displayorder" value="{$item['displayorder']}"></td>
						<td class="text-center">{if $item['display']}显示{else}隐藏{/if}</td>
						<td class="text-center">{$item['jump']}</td>
						<td class="text-center">
							<a href="{php echo $this->createWebUrl('huodong_post',array('id'=>$item['id']))}" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="top" title="" data-original-title="修改"><i class="fa fa-edit"></i></a>
							<a href="{php echo $this->createWebUrl('huodong_post',array('act'=>'del','id'=>$item['id']))}" onclick="return confirm('确认删除吗？');return false;" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="" data-original-title="删除"><i class="fa fa-times"></i></a>
						</td>
					</tr>
				{/loop}
				{if empty($list) }
                <tr ng-if="!wechats">
                <td colspan="9" class="text-center">暂无数据</td>
                </tr>
                {/if}
				<tr>
					<td colspan="7" style="text-align:right">{$page}</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript">
$(".displayorder").bind('input propertychange',function(){
	$.ajax({
	    url:"{php echo $this->createWebUrl('huodong_post',array('act'=>'display'))}",
	    type:'POST',
	    async:true,
	    data:{
	        displayorder:$(this).val(),id:$(this).attr('data-id')
	    },
	    timeout:5000,
	    dataType:'json',
	    success:function(data){
	        //alert(data.message);
	    }
	})
})
</script>
</div>
{template 'common/footer'}
